package com.stek.utils;

import com.google.android.gms.ads.AdListener;
import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.AdView;

public class AdMode {
	public static void init(AdView adView) {
		// Create an ad request. Check logcat output for the hashed device ID to
		// get test ads on a physical device.
		// Set the AdListener.
		adView.setAdListener(new AdListener() {
			/**
			 * Called when an ad is clicked and about to return to the
			 * application.
			 */
			@Override
			public void onAdClosed() {
				Logging.log("onAdClosed");
			}

			/** Called when an ad failed to load. */
			@Override
			public void onAdFailedToLoad(int error) {
				Logging.log("onAdFailedToLoad");
			}

			/**
			 * Called when an ad is clicked and going to start a new Activity
			 * that will leave the application (e.g. breaking out to the Browser
			 * or Maps application).
			 */
			@Override
			public void onAdLeftApplication() {
				Logging.log("onAdLeftApplication");
			}

			/**
			 * Called when an Activity is created in front of the app (e.g. an
			 * interstitial is shown, or an ad is clicked and launches a new
			 * Activity).
			 */
			@Override
			public void onAdOpened() {
				Logging.log("onAdOpened");
			}

			/** Called when an ad is loaded. */
			@Override
			public void onAdLoaded() {
				Logging.log("onAdLoaded");
			}
		});
		AdRequest adRequest = new AdRequest.Builder().build();

		// Start loading the ad in the background.
		adView.loadAd(adRequest);
	}
}
